/**
 * @author Ashish Tomar
 * This shows you some ways to use Yahoo Quote in Scala.
 */

package main.scala

import Finance.YahooQuote



object YahooQuoteCaller {


	def main(args: Array[String]): Unit = {

			val yqc:YahooQuote  = new YahooQuote

			println("Example - getOneQuote with one Symbol as a single String Argument")
			val listOfArray = yqc.getOneQuote("IBM")
			yqc.printListOfArray(listOfArray)
			println("Length of returned Array : "+listOfArray(0).length)
			println("------------")

			println("Example - getQuote with a List of Symbols as Argument")
			val listOfArray2 = yqc.getQuote(List("DELL","AAPL","Apple","PTTRX","0307.HK"))
			yqc.printListOfArray(listOfArray2)
			println("Length of returned Array : "+listOfArray2(0).length)
			println("------------")
		
		
			println("Example - getQuote with Seeting the Server URL")
			yqc.setURLServerString("http://sg.finance.yahoo.com",true)
		
			val listOfArray3 = yqc.getQuote(List("0307.HK"))
			yqc.printListOfArray(listOfArray3)
			println("Length of returned Array : "+listOfArray3(0).length)
			println("------------")
		
			println("Example - getQuote with Extended and Realtime query format")
			yqc.setURLServerString("http://download.finance.yahoo.com/d/quotes.csvr?e=.csv&f=",false)
		
			yqc.useExtendedQueryFormat
			yqc.useRealtimeQueryFormat
		
			val listOfArray4 = yqc.getQuote(List("0307.HK"))
			yqc.printListOfArray(listOfArray4)
			println("Length of returned Array : "+listOfArray4(0).length)
			println("------------")
		
		
			println("Example - getQuote with setting the format query string")
			yqc.setQueryString("snl")
			val listOfArray5 = yqc.getQuote(List("0307.HK"))
			yqc.printListOfArray(listOfArray5)
			println("Length of returned Array : "+listOfArray5(0).length)
			println("------------")
		
		
		
			println("Example - Custom Quote")
			val listOfArray6 = yqc.getCustomQuote(List("DELL","IBM"), List("Name","Book Value"))
			yqc.printListOfArray(listOfArray6)
			println("Length of returned Array : "+listOfArray6(0).length)
			println("------------")
		
		
		
		
			println("Example - getQuote with more than 200 symbols")
			val listOfSymbols = List(
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple","IBM","Apple",
					"Microsoft","Apple","IBM"
			)
		
		
			yqc.setQueryStringBackToDefault()
			val listOfArray7 = yqc.getQuote(listOfSymbols)
			yqc.printListOfArray(listOfArray7)
			println("Number of Symbols : "+listOfArray7.length)
			println("Length of returned Array : "+listOfArray7(0).length)
			println("------------")
		
		
		




	}





}